<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .hello{
        margin-top: 50px;
        text-align:center;
    }
    .change{
        margin-top: 20px;
        text-align:center;
    }

</style>

<body>
    <div id="hello" class="hello" >hello world!</div>
    <div class="change">    
        <button onclick="red()"style="margin:0px auto;">颜色变为红的</button>
        <button onclick="black()"style="margin:0px auto;">颜色复原</button>
    </div>

</body>
<script>
    var hello=document.getElementById('hello');
    function red(){
        hello.style.color="red";
    }
    function black(){
        hello.style.color="black";
    }
</script>
</html>